package com.yiqi.liebang.feature.mine.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.PageData;
import com.yiqi.liebang.entity.bo.AddTopicBo;
import com.yiqi.liebang.entity.bo.CouponBo;
import com.yiqi.liebang.entity.bo.PageBo;
import com.yiqi.liebang.entity.bo.WorkBo;
import com.yiqi.liebang.feature.mine.contract.CouponContract;
import com.yiqi.liebang.feature.mine.contract.TopicContract;
import com.yiqi.liebang.feature.mine.dependencies.coupon.DaggerCouponModelComponent;
import com.yiqi.liebang.feature.mine.dependencies.topic.DaggerTopicModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.UserApi;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class CouponModel implements CouponContract.Model {

    @Inject
    UserApi api;


    @Inject
    public CouponModel() {
        DaggerCouponModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<CouponBo>> getCoupon(PageBo workBo) {
        return api.getCoupon(workBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
